// shortVideoPlayer.vue 的 <script setup>顶部（修改导入部分）
import { useTemplateRef } from '../../hooks/useTemplateRef';
import { useTouchSwipe } from '../../hooks/useTouchSwipe';
import { useVideoStore } from '@/store/modules/video';
import CommentSection from '@/components/common/commentSection.vue';
import { useVideoPlayer } from '@/hooks/useVideoPlayer';
import { useVideoInteractions } from '@/hooks/useVideoInteractions';
// 👇 关键：补充导入 ref 和 nextTick（之前漏了！）
import { computed, ref, watch, nextTick, onMounted } from 'vue';
import { useSocketInteractions } from '@/hooks/useSocketInteractions';
const { sendLike } = useSocketInteractions()

// ... 其他代码不变 ...

// 👇 修复 touchEnd 里的事件名（load-more → loadMore）
const touchEnd = (e) => {
  if (!props.enableSwipe) return;
  const prevIndex = currentIndex.value;
  console.log('prevIndex:', prevIndex);

  end(e);
  if (videoBoxRef.value) {
    videoBoxRef.value.style.transition = 'transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94)';
  }
  // 👇 优化：不用computed，直接取值（减少冗余）
  const lastVideoIndex = props.videoList.length - 1;
  const hasMore = props.hasMore;

  console.log('currentIndex:', currentIndex.value);

  if (
    currentIndex.value === lastVideoIndex &&
    hasMore &&
    !isLoadingMore.value
  ) {
    isLoadingMore.value = true; // 标记为加载中
    emit('loadMore'); // 👈 改为和父组件一致的事件名
  } else {
    console.log('没有更多视频可加载');
  }
};

// ... 其他代码不变 ...